CMAKE_MINIMUM_REQUIRED(VERSION 2.8)

include_directories(${PROJECT_SOURCE_DIR}/comn/include)
include_directories(${PROJECT_SOURCE_DIR}/third_party/tinyxml)
include_directories(${RESIP_DIR}/)

link_directories(${PROJECT_SOURCE_DIR}/lib)
link_directories(${PROJECT_SOURCE_DIR}/comn/lib)
link_directories(${PROJECT_SOURCE_DIR}/third_party/lib)
link_directories(${PROJECT_SOURCE_DIR}/third_party/tinyxml/lib)

include_directories(${THIRD_PARTY}/jrtplib/include/jrtplib3)
set(LIB_JRTP debug jrtplib_d optimized jrtplib)
link_directories(${THIRD_PARTY}/jrtplib/lib)

include_directories(rtp)

aux_source_directory(. SOURCE)
FILE(GLOB HEADER "*.h")

aux_source_directory(rtp SOURCE)

if (NOCRT)
	set(CMAKE_MFC_FLAG 1)
	list(APPEND LIB_PLATFORM debug nafxcwd optimized nafxcw)
else()
	add_definitions(-D_AFXDLL)
	set(CMAKE_MFC_FLAG 2)
endif()

add_executable(SipShell WIN32 ${SOURCE} ${HEADER} SipShell.rc)

target_link_libraries(SipShell
	${LIB_PLATFORM}
	Dnsapi
	Iphlpapi
	winmm
	ares
	rutil
	resiprocate
	dum
	debug tinyxmlD optimized tinyxml
	debug comnD optimized comn 
	${LIB_JRTP})

#set_target_properties(SipShell PROPERTIES LINK_INTERFACE_LIBRARIES "")


install(TARGETS SipShell DESTINATION .)

install(FILES ${PROJECT_SOURCE_DIR}/config/SipShell.ini DESTINATION .)
install(FILES ${PROJECT_SOURCE_DIR}/config/sample.xml DESTINATION .)
install(FILES ${PROJECT_SOURCE_DIR}/config/LocalAudio.pcm DESTINATION .)
install(FILES ${PROJECT_SOURCE_DIR}/tool/ffplay.exe DESTINATION .)



if(WIN32)
	
else()
	
endif()

set(CMAKE_INSTALL_SYSTEM_RUNTIME_DESTINATION .)

include(InstallRequiredSystemLibraries)

set(CPACK_PACKAGE_NAME "Shell28181")
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "SIP Shell")
set(CPACK_PACKAGE_VENDOR "www.100wits.com")
set(CPACK_PACKAGE_VERSION_MAJOR "1")
set(CPACK_PACKAGE_VERSION_MINOR "0")
set(CPACK_PACKAGE_VERSION_PATCH "0")

SET(CPACK_GENERATOR "ZIP")

set(CPACK_OUTPUT_FILE_PREFIX "${CMAKE_CURRENT_SOURCE_DIR}/../dist") 
set(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}") 

include(CPack)